home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / info / lispref.info-13.z / lispref.info-13
Encoding:
GNU Info File  |  1998-05-21  |  50.9 KB  |  1,243 lines

  1. This is Info file ../../info/lispref.info, produced by Makeinfo version
  2. 1.68 from the input file lispref.texi.
  3.  
  4.    Edition History:
  5.  
  6.    GNU Emacs Lisp Reference Manual Second Edition (v2.01), May 1993 GNU
  7. Emacs Lisp Reference Manual Further Revised (v2.02), August 1993 Lucid
  8. Emacs Lisp Reference Manual (for 19.10) First Edition, March 1994
  9. XEmacs Lisp Programmer's Manual (for 19.12) Second Edition, April 1995
  10. GNU Emacs Lisp Reference Manual v2.4, June 1995 XEmacs Lisp
  11. Programmer's Manual (for 19.13) Third Edition, July 1995 XEmacs Lisp
  12. Reference Manual (for 19.14 and 20.0) v3.1, March 1996 XEmacs Lisp
  13. Reference Manual (for 19.15 and 20.1, 20.2) v3.2, April, May 1997
  14.  
  15.    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software
  16. Foundation, Inc.  Copyright (C) 1994, 1995 Sun Microsystems, Inc.
  17. Copyright (C) 1995, 1996 Ben Wing.
  18.  
  19.    Permission is granted to make and distribute verbatim copies of this
  20. manual provided the copyright notice and this permission notice are
  21. preserved on all copies.
  22.  
  23.    Permission is granted to copy and distribute modified versions of
  24. this manual under the conditions for verbatim copying, provided that the
  25. entire resulting derived work is distributed under the terms of a
  26. permission notice identical to this one.
  27.  
  28.    Permission is granted to copy and distribute translations of this
  29. manual into another language, under the above conditions for modified
  30. versions, except that this permission notice may be stated in a
  31. translation approved by the Foundation.
  32.  
  33.    Permission is granted to copy and distribute modified versions of
  34. this manual under the conditions for verbatim copying, provided also
  35. that the section entitled "GNU General Public License" is included
  36. exactly as in the original, and provided that the entire resulting
  37. derived work is distributed under the terms of a permission notice
  38. identical to this one.
  39.  
  40.    Permission is granted to copy and distribute translations of this
  41. manual into another language, under the above conditions for modified
  42. versions, except that the section entitled "GNU General Public License"
  43. may be included in a translation approved by the Free Software
  44. Foundation instead of in the original English.
  45.  
  46. 
  47. File: lispref.info,  Node: Using Edebug,  Next: Instrumenting,  Up: Edebug
  48.  
  49. Using Edebug
  50. ------------
  51.  
  52.    To debug an XEmacs Lisp program with Edebug, you must first
  53. "instrument" the Lisp code that you want to debug.  If you want to just
  54. try it now, load `edebug.el', move point into a definition and do `C-u
  55. C-M-x' (`eval-defun' with a prefix argument).  See *Note
  56. Instrumenting:: for alternative ways to instrument code.
  57.  
  58.    Once a function is instrumented, any call to the function activates
  59. Edebug.  Activating Edebug may stop execution and let you step through
  60. the function, or it may update the display and continue execution while
  61. checking for debugging commands, depending on the selected Edebug
  62. execution mode.  The initial execution mode is `step', by default,
  63. which does stop execution.  *Note Edebug Execution Modes::.
  64.  
  65.    Within Edebug, you normally view an XEmacs buffer showing the source
  66. of the Lisp function you are debugging.  This is referred to as the
  67. "source code buffer"--but note that it is not always the same buffer
  68. depending on which function is currently being executed.
  69.  
  70.    An arrow at the left margin indicates the line where the function is
  71. executing.  Point initially shows where within the line the function is
  72. executing, but you can move point yourself.
  73.  
  74.    If you instrument the definition of `fac' (shown below) and then
  75. execute `(fac 3)', here is what you normally see.  Point is at the
  76. open-parenthesis before `if'.
  77.  
  78.      (defun fac (n)
  79.      =>-!-(if (< 0 n)
  80.            (* n (fac (1- n)))
  81.          1))
  82.  
  83.    The places within a function where Edebug can stop execution are
  84. called "stop points".  These occur both before and after each
  85. subexpression that is a list, and also after each variable reference.
  86. Here we show with periods the stop points found in the function `fac':
  87.  
  88.      (defun fac (n)
  89.        .(if .(< 0 n.).
  90.            .(* n. .(fac (1- n.).).).
  91.          1).)
  92.  
  93.    While the source code buffer is selected, the special commands of
  94. Edebug are available in it, in addition to the commands of XEmacs Lisp
  95. mode.  (The buffer is temporarily made read-only, however.)  For
  96. example, you can type the Edebug command <SPC> to execute until the
  97. next stop point.  If you type <SPC> once after entry to `fac', here is
  98. the display you will see:
  99.  
  100.      (defun fac (n)
  101.      =>(if -!-(< 0 n)
  102.            (* n (fac (1- n)))
  103.          1))
  104.  
  105.    When Edebug stops execution after an expression, it displays the
  106. expression's value in the echo area.
  107.  
  108.    Other frequently used commands are `b' to set a breakpoint at a stop
  109. point, `g' to execute until a breakpoint is reached, and `q' to exit to
  110. the top-level command loop.  Type `?' to display a list of all Edebug
  111. commands.
  112.  
  113. 
  114. File: lispref.info,  Node: Instrumenting,  Next: Edebug Execution Modes,  Prev: Using Edebug,  Up: Edebug
  115.  
  116. Instrumenting for Edebug
  117. ------------------------
  118.  
  119.    In order to use Edebug to debug Lisp code, you must first
  120. "instrument" the code.  Instrumenting a form inserts additional code
  121. into it which invokes Edebug at the proper places.  Furthermore, if
  122. Edebug detects a syntax error while instrumenting, point is left at the
  123. erroneous code and an `invalid-read-syntax' error is signaled.
  124.  
  125.    Once you have loaded Edebug, the command `C-M-x' (`eval-defun') is
  126. redefined so that when invoked with a prefix argument on a definition,
  127. it instruments the definition before evaluating it.  (The source code
  128. itself is not modified.)  If the variable `edebug-all-defs' is
  129. non-`nil', that inverts the meaning of the prefix argument: then
  130. `C-M-x' instruments the definition *unless* it has a prefix argument.
  131. The default value of `edebug-all-defs' is `nil'.  The command `M-x
  132. edebug-all-defs' toggles the value of the variable `edebug-all-defs'.
  133.  
  134.    If `edebug-all-defs' is non-`nil', then the commands `eval-region',
  135. `eval-current-buffer', and `eval-buffer' also instrument any
  136. definitions they evaluate.  Similarly, `edebug-all-forms' controls
  137. whether `eval-region' should instrument *any* form, even non-defining
  138. forms.  This doesn't apply to loading or evaluations in the minibuffer.
  139. The command `M-x edebug-all-forms' toggles this option.
  140.  
  141.    Another command, `M-x edebug-eval-top-level-form', is available to
  142. instrument any top-level form regardless of the value of
  143. `edebug-all-defs' or `edebug-all-forms'.
  144.  
  145.    Just before Edebug instruments any code, it calls any functions in
  146. the variable `edebug-setup-hook' and resets its value to `nil'.  You
  147. could use this to load up Edebug specifications associated with a
  148. package you are using but only when you also use Edebug.  For example,
  149. `my-specs.el' may be loaded automatically when you use `my-package'
  150. with Edebug by including the following code in `my-package.el'.
  151.  
  152.      (add-hook 'edebug-setup-hook
  153.        (function (lambda () (require 'my-specs))))
  154.  
  155.    While Edebug is active, the command `I' (`edebug-instrument-callee')
  156. instruments the definition of the function or macro called by the list
  157. form after point, if is not already instrumented.  If the location of
  158. the definition is not known to Edebug, this command cannot be used.
  159. After loading Edebug, `eval-region' records the position of every
  160. definition it evaluates, even if not instrumenting it.  Also see the
  161. command `i' (*Note Jumping::) which steps into the callee.
  162.  
  163.    Edebug knows how to instrument all the standard special forms, an
  164. interactive form with an expression argument, anonymous lambda
  165. expressions, and other defining forms.  (Specifications for macros
  166. defined by `cl.el' (version 2.03) are provided in `cl-specs.el'.)
  167. Edebug cannot know what a user-defined macro will do with the arguments
  168. of a macro call so you must tell it.  See *Note Instrumenting Macro
  169. Calls:: for the details.
  170.  
  171.    Note that a couple ways remain to evaluate expressions without
  172. instrumenting them.  Loading a file via the `load' subroutine does not
  173. instrument expressions for Edebug.  Evaluations in the minibuffer via
  174. `eval-expression' (`M-ESC') are not instrumented.
  175.  
  176.    To remove instrumentation from a definition, simply reevaluate it
  177. with one of the non-instrumenting commands, or reload the file.
  178.  
  179.    See *Note Edebug Eval:: for other evaluation functions available
  180. inside of Edebug.
  181.  
  182. 
  183. File: lispref.info,  Node: Edebug Execution Modes,  Next: Jumping,  Prev: Instrumenting,  Up: Edebug
  184.  
  185. Edebug Execution Modes
  186. ----------------------
  187.  
  188.    Edebug supports several execution modes for running the program you
  189. are debugging.  We call these alternatives "Edebug execution modes"; do
  190. not confuse them with major or minor modes.  The current Edebug
  191. execution mode determines how Edebug displays the progress of the
  192. evaluation, whether it stops at each stop point, or continues to the
  193. next breakpoint, for example.
  194.  
  195.    Normally, you specify the Edebug execution mode by typing a command
  196. to continue the program in a certain mode.  Here is a table of these
  197. commands.  All except for `S' resume execution of the program, at least
  198. for a certain distance.
  199.  
  200. `S'
  201.      Stop: don't execute any more of the program for now, just wait for
  202.      more Edebug commands (`edebug-stop').
  203.  
  204. `<SPC>'
  205.      Step: stop at the next stop point encountered (`edebug-step-mode').
  206.  
  207. `n'
  208.      Next: stop at the next stop point encountered after an expression
  209.      (`edebug-next-mode').  Also see `edebug-forward-sexp' in *Note
  210.      Edebug Misc::.
  211.  
  212. `t'
  213.      Trace: pause one second at each Edebug stop point
  214.      (`edebug-trace-mode').
  215.  
  216. `T'
  217.      Rapid trace: update at each stop point, but don't actually pause
  218.      (`edebug-Trace-fast-mode').
  219.  
  220. `g'
  221.      Go: run until the next breakpoint (`edebug-go-mode').  *Note
  222.      Breakpoints::.
  223.  
  224. `c'
  225.      Continue: pause for one second at each breakpoint, but don't stop
  226.      (`edebug-continue-mode').
  227.  
  228. `C'
  229.      Rapid continue: update at each breakpoint, but don't actually pause
  230.      (`edebug-Continue-fast-mode').
  231.  
  232. `G'
  233.      Go non-stop: ignore breakpoints (`edebug-Go-nonstop-mode').  You
  234.      can still stop the program by hitting any key.
  235.  
  236.    In general, the execution modes earlier in the above list run the
  237. program more slowly or stop sooner.
  238.  
  239.    When you enter a new Edebug level, the initial execution mode comes
  240. from the value of the variable `edebug-initial-mode'.  By default, this
  241. specifies `step' mode.  Note that you may reenter the same Edebug level
  242. several times if, for example, an instrumented function is called
  243. several times from one command.
  244.  
  245.    While executing or tracing, you can interrupt the execution by typing
  246. any Edebug command.  Edebug stops the program at the next stop point and
  247. then executes the command that you typed.  For example, typing `t'
  248. during execution switches to trace mode at the next stop point.  You can
  249. use `S' to stop execution without doing anything else.
  250.  
  251.    If your function happens to read input, a character you hit
  252. intending to interrupt execution may be read by the function instead.
  253. You can avoid such unintended results by paying attention to when your
  254. program wants input.
  255.  
  256.    Keyboard macros containing Edebug commands do not work; when you exit
  257. from Edebug, to resume the program, whether you are defining or
  258. executing a keyboard macro is forgotten.  Also, defining or executing a
  259. keyboard macro outside of Edebug does not affect the command loop inside
  260. Edebug.  This is usually an advantage.  But see
  261. `edebug-continue-kbd-macro'.
  262.  
  263. 
  264. File: lispref.info,  Node: Jumping,  Next: Edebug Misc,  Prev: Edebug Execution Modes,  Up: Edebug
  265.  
  266. Jumping
  267. -------
  268.  
  269.    Commands described here let you jump to a specified location.  All,
  270. except `i', use temporary breakpoints to establish the stop point and
  271. then switch to `go' mode.  Any other breakpoint reached before the
  272. intended stop point will also stop execution.  See *Note Breakpoints::
  273. for the details on breakpoints.
  274.  
  275. `f'
  276.      Run the program forward over one expression
  277.      (`edebug-forward-sexp').  More precisely, set a temporary
  278.      breakpoint at the position that `C-M-f' would reach, then execute
  279.      in `go' mode so that the program will stop at breakpoints.
  280.  
  281.      With a prefix argument N, the temporary breakpoint is placed N
  282.      sexps beyond point.  If the containing list ends before N more
  283.      elements, then the place to stop is after the containing
  284.      expression.
  285.  
  286.      Be careful that the position `C-M-f' finds is a place that the
  287.      program will really get to; this may not be true in a `cond', for
  288.      example.
  289.  
  290.      This command does `forward-sexp' starting at point rather than the
  291.      stop point.  If you want to execute one expression from the
  292.      current stop point, type `w' first, to move point there.
  293.  
  294. `o'
  295.      Continue "out of" an expression (`edebug-step-out').  It places a
  296.      temporary breakpoint at the end of the sexp containing point.
  297.  
  298.      If the containing sexp is a function definition itself, it
  299.      continues until just before the last sexp in the definition.  If
  300.      that is where you are now, it returns from the function and then
  301.      stops.  In other words, this command does not exit the currently
  302.      executing function unless you are positioned after the last sexp.
  303.  
  304. `I'
  305.      Step into the function or macro after point after first ensuring
  306.      that it is instrumented.  It does this by calling
  307.      `edebug-on-entry' and then switching to `go' mode.
  308.  
  309.      Although the automatic instrumentating is convenient, it is not
  310.      later automatically uninstrumented.
  311.  
  312. `h'
  313.      Proceed to the stop point near where point is using a temporary
  314.      breakpoint (`edebug-goto-here').
  315.  
  316.    All the commands in this section may fail to work as expected in case
  317. of nonlocal exit, because a nonlocal exit can bypass the temporary
  318. breakpoint where you expected the program to stop.
  319.  
  320. 
  321. File: lispref.info,  Node: Edebug Misc,  Next: Breakpoints,  Prev: Jumping,  Up: Edebug
  322.  
  323. Miscellaneous
  324. -------------
  325.  
  326.    Some miscellaneous commands are described here.
  327.  
  328. `?'
  329.      Display the help message for Edebug (`edebug-help').
  330.  
  331. `C-]'
  332.      Abort one level back to the previous command level
  333.      (`abort-recursive-edit').
  334.  
  335. `q'
  336.      Return to the top level editor command loop (`top-level').  This
  337.      exits all recursive editing levels, including all levels of Edebug
  338.      activity.  However, instrumented code protected with
  339.      `unwind-protect' or `condition-case' forms may resume debugging.
  340.  
  341. `Q'
  342.      Like `q' but don't stop even for protected code
  343.      (`top-level-nonstop').
  344.  
  345. `r'
  346.      Redisplay the most recently known expression result in the echo
  347.      area (`edebug-previous-result').
  348.  
  349. `d'
  350.      Display a backtrace, excluding Edebug's own functions for clarity
  351.      (`edebug-backtrace').
  352.  
  353.      You cannot use debugger commands in the backtrace buffer in Edebug
  354.      as you would in the standard debugger.
  355.  
  356.      The backtrace buffer is killed automatically when you continue
  357.      execution.
  358.  
  359.    From the Edebug recursive edit, you may invoke commands that activate
  360. Edebug again recursively.  Any time Edebug is active, you can quit to
  361. the top level with `q' or abort one recursive edit level with `C-]'.
  362. You can display a backtrace of all the pending evaluations with `d'.
  363.  
  364. 
  365. File: lispref.info,  Node: Breakpoints,  Next: Trapping Errors,  Prev: Edebug Misc,  Up: Edebug
  366.  
  367. Breakpoints
  368. -----------
  369.  
  370.    There are three more ways to stop execution once it has started:
  371. breakpoints, the global break condition, and embedded breakpoints.
  372.  
  373.    While using Edebug, you can specify "breakpoints" in the program you
  374. are testing: points where execution should stop.  You can set a
  375. breakpoint at any stop point, as defined in *Note Using Edebug::.  For
  376. setting and unsetting breakpoints, the stop point that is affected is
  377. the first one at or after point in the source code buffer.  Here are the
  378. Edebug commands for breakpoints:
  379.  
  380. `b'
  381.      Set a breakpoint at the stop point at or after point
  382.      (`edebug-set-breakpoint').  If you use a prefix argument, the
  383.      breakpoint is temporary (it turns off the first time it stops the
  384.      program).
  385.  
  386. `u'
  387.      Unset the breakpoint (if any) at the stop point at or after the
  388.      current point (`edebug-unset-breakpoint').
  389.  
  390. `x CONDITION <RET>'
  391.      Set a conditional breakpoint which stops the program only if
  392.      CONDITION evaluates to a non-`nil' value
  393.      (`edebug-set-conditional-breakpoint').  If you use a prefix
  394.      argument, the breakpoint is temporary (it turns off the first time
  395.      it stops the program).
  396.  
  397. `B'
  398.      Move point to the next breakpoint in the definition
  399.      (`edebug-next-breakpoint').
  400.  
  401.    While in Edebug, you can set a breakpoint with `b' and unset one
  402. with `u'.  First you must move point to a position at or before the
  403. desired Edebug stop point, then hit the key to change the breakpoint.
  404. Unsetting a breakpoint that has not been set does nothing.
  405.  
  406.    Reevaluating or reinstrumenting a definition clears all its
  407. breakpoints.
  408.  
  409.    A "conditional breakpoint" tests a condition each time the program
  410. gets there.  To set a conditional breakpoint, use `x', and specify the
  411. condition expression in the minibuffer.  Setting a conditional
  412. breakpoint at a stop point that already has a conditional breakpoint
  413. puts the current condition expression in the minibuffer so you can edit
  414. it.
  415.  
  416.    You can make both conditional and unconditional breakpoints
  417. "temporary" by using a prefix arg to the command to set the breakpoint.
  418. After breaking at a temporary breakpoint, it is automatically cleared.
  419.  
  420.    Edebug always stops or pauses at a breakpoint except when the Edebug
  421. mode is `Go-nonstop'.  In that mode, it ignores breakpoints entirely.
  422.  
  423.    To find out where your breakpoints are, use `B', which moves point
  424. to the next breakpoint in the definition following point, or to the
  425. first breakpoint if there are no following breakpoints.  This command
  426. does not continue execution--it just moves point in the buffer.
  427.  
  428. * Menu:
  429.  
  430. * Global Break Condition::    Breaking on an event.
  431. * Embedded Breakpoints::    Embedding breakpoints in code.
  432.  
  433. 
  434. File: lispref.info,  Node: Global Break Condition,  Next: Embedded Breakpoints,  Up: Breakpoints
  435.  
  436. Global Break Condition
  437. ......................
  438.  
  439.    In contrast to breaking when execution reaches specified locations,
  440. you can also cause a break when a certain event occurs.  The "global
  441. break condition" is a condition that is repeatedly evaluated at every
  442. stop point.  If it evaluates to a non-`nil' value, then execution is
  443. stopped or paused depending on the execution mode, just like a
  444. breakpoint.  Any errors that might occur as a result of evaluating the
  445. condition are ignored, as if the result were `nil'.
  446.  
  447.    You can set or edit the condition expression, stored in
  448. `edebug-global-break-condition', using `X'
  449. (`edebug-set-global-break-condition').
  450.  
  451.    Using the global break condition is perhaps the fastest way to find
  452. where in your code some event occurs, but since it is rather expensive
  453. you should reset the condition to `nil' when not in use.
  454.  
  455. 
  456. File: lispref.info,  Node: Embedded Breakpoints,  Prev: Global Break Condition,  Up: Breakpoints
  457.  
  458. Embedded Breakpoints
  459. ....................
  460.  
  461.    Since all breakpoints in a definition are cleared each time you
  462. reinstrument it, you might rather create an "embedded breakpoint" which
  463. is simply a call to the function `edebug'.  You can, of course, make
  464. such a call conditional.  For example, in the `fac' function, insert
  465. the first line as shown below to stop when the argument reaches zero:
  466.  
  467.      (defun fac (n)
  468.        (if (= n 0) (edebug))
  469.        (if (< 0 n)
  470.            (* n (fac (1- n)))
  471.          1))
  472.  
  473.    When the `fac' definition is instrumented and the function is
  474. called, Edebug will stop before the call to `edebug'.  Depending on the
  475. execution mode, Edebug will stop or pause.
  476.  
  477.    However, if no instrumented code is being executed, calling `edebug'
  478. will instead invoke `debug'.  Calling `debug' will always invoke the
  479. standard backtrace debugger.
  480.  
  481. 
  482. File: lispref.info,  Node: Trapping Errors,  Next: Edebug Views,  Prev: Breakpoints,  Up: Edebug
  483.  
  484. Trapping Errors
  485. ---------------
  486.  
  487.    An error may be signaled by subroutines or XEmacs Lisp code.  If a
  488. signal is not handled by a `condition-case', this indicates an
  489. unrecognized situation has occurred.  If Edebug is not active when an
  490. unhandled error is signaled, `debug' is run normally (if
  491. `debug-on-error' is non-`nil').  But while Edebug is active,
  492. `debug-on-error' and `debug-on-quit' are bound to `edebug-on-error' and
  493. `edebug-on-quit', which are both `t' by default.  Actually, if
  494. `debug-on-error' already has a non-`nil' value, that value is still
  495. used.
  496.  
  497.    It is best to change the values of `edebug-on-error' or
  498. `edebug-on-quit' when Edebug is not active since their values won't be
  499. used until the next time Edebug is invoked at a deeper command level.
  500. If you only change `debug-on-error' or `debug-on-quit' while Edebug is
  501. active, these changes will be forgotten when Edebug becomes inactive.
  502. Furthermore, during Edebug's recursive edit, these variables are bound
  503. to the values they had outside of Edebug.
  504.  
  505.    Edebug shows you the last stop point that it knew about before the
  506. error was signaled.  This may be the location of a call to a function
  507. which was not instrumented, within which the error actually occurred.
  508. For an unbound variable error, the last known stop point might be quite
  509. distant from the offending variable.  If the cause of the error is not
  510. obvious at first, note that you can also get a full backtrace inside of
  511. Edebug (see *Note Edebug Misc::).
  512.  
  513.    Edebug can also trap signals even if they are handled.  If
  514. `debug-on-error' is a list of signal names, Edebug will stop when any
  515. of these errors are signaled.  Edebug shows you the last known stop
  516. point just as for unhandled errors.  After you continue execution, the
  517. error is signaled again (but without being caught by Edebug).  Edebug
  518. can only trap errors that are handled if they are signaled in Lisp code
  519. (not subroutines) since it does so by temporarily replacing the
  520. `signal' function.
  521.  
  522. 
  523. File: lispref.info,  Node: Edebug Views,  Next: Edebug Eval,  Prev: Trapping Errors,  Up: Edebug
  524.  
  525. Edebug Views
  526. ------------
  527.  
  528.    The following Edebug commands let you view aspects of the buffer and
  529. window status that obtained before entry to Edebug.
  530.  
  531. `v'
  532.      View the outside window configuration (`edebug-view-outside').
  533.  
  534. `p'
  535.      Temporarily display the outside current buffer with point at its
  536.      outside position (`edebug-bounce-point'). If prefix arg is
  537.      supplied, sit for that many seconds instead.
  538.  
  539. `w'
  540.      Move point back to the current stop point (`edebug-where') in the
  541.      source code buffer.  Also, if you use this command in another
  542.      window displaying the same buffer, this window will be used
  543.      instead to display the buffer in the future.
  544.  
  545. `W'
  546.      Toggle the `edebug-save-windows' variable which indicates whether
  547.      the outside window configuration is saved and restored
  548.      (`edebug-toggle-save-windows').  Also, each time it is toggled on,
  549.      make the outside window configuration the same as the current
  550.      window configuration.
  551.  
  552.      With a prefix argument, `edebug-toggle-save-windows' only toggles
  553.      saving and restoring of the selected window.  To specify a window
  554.      that is not displaying the source code buffer, you must use
  555.      `C-xXW' from the global keymap.
  556.  
  557.    You can view the outside window configuration with `v' or just
  558. bounce to the current point in the current buffer with `p', even if it
  559. is not normally displayed.  After moving point, you may wish to pop
  560. back to the stop point with `w' from a source code buffer.
  561.  
  562.    By using `W' twice, Edebug again saves and restores the outside
  563. window configuration, but to the current configuration.  This is a
  564. convenient way to, for example, add another buffer to be displayed
  565. whenever Edebug is active.  However, the automatic redisplay of
  566. `*edebug*' and `*edebug-trace*' may conflict with the buffers you wish
  567. to see unless you have enough windows open.
  568.  
  569. 
  570. File: lispref.info,  Node: Edebug Eval,  Next: Eval List,  Prev: Edebug Views,  Up: Edebug
  571.  
  572. Evaluation
  573. ----------
  574.  
  575.    While within Edebug, you can evaluate expressions "as if" Edebug were
  576. not running.  Edebug tries to be invisible to the expression's
  577. evaluation and printing.  Evaluation of expressions that cause side
  578. effects will work as expected except for things that Edebug explicitly
  579. saves and restores.  See *Note The Outside Context:: for details on this
  580. process.  Also see *Note Reading in Edebug:: and *Note Printing in
  581. Edebug:: for topics related to evaluation.
  582.  
  583. `e EXP <RET>'
  584.      Evaluate expression EXP in the context outside of Edebug
  585.      (`edebug-eval-expression').  In other words, Edebug tries to avoid
  586.      altering the effect of EXP.
  587.  
  588. `M-<ESC> EXP <RET>'
  589.      Evaluate expression EXP in the context of Edebug itself.
  590.  
  591. `C-x C-e'
  592.      Evaluate the expression before point, in the context outside of
  593.      Edebug (`edebug-eval-last-sexp').
  594.  
  595.    Edebug supports evaluation of expressions containing references to
  596. lexically bound symbols created by the following constructs in `cl.el'
  597. (version 2.03 or later): `lexical-let', `macrolet', and
  598. `symbol-macrolet'.
  599.  
  600. 
  601. File: lispref.info,  Node: Eval List,  Next: Reading in Edebug,  Prev: Edebug Eval,  Up: Edebug
  602.  
  603. Evaluation List Buffer
  604. ----------------------
  605.  
  606.    You can use the "evaluation list buffer", called `*edebug*', to
  607. evaluate expressions interactively.  You can also set up the
  608. "evaluation list" of expressions to be evaluated automatically each
  609. time Edebug updates the display.
  610.  
  611. `E'
  612.      Switch to the evaluation list buffer `*edebug*'
  613.      (`edebug-visit-eval-list').
  614.  
  615.    In the `*edebug*' buffer you can use the commands of Lisp
  616. Interaction as well as these special commands:
  617.  
  618. `LFD'
  619.      Evaluate the expression before point, in the outside context, and
  620.      insert the value in the buffer (`edebug-eval-print-last-sexp').
  621.  
  622. `C-x C-e'
  623.      Evaluate the expression before point, in the context outside of
  624.      Edebug (`edebug-eval-last-sexp').
  625.  
  626. `C-c C-u'
  627.      Build a new evaluation list from the first expression of each
  628.      group, reevaluate and redisplay (`edebug-update-eval-list').
  629.      Groups are separated by comment lines.
  630.  
  631. `C-c C-d'
  632.      Delete the evaluation list group that point is in
  633.      (`edebug-delete-eval-item').
  634.  
  635. `C-c C-w'
  636.      Switch back to the source code buffer at the current stop point
  637.      (`edebug-where').
  638.  
  639.    You can evaluate expressions in the evaluation list window with
  640. `LFD' or `C-x C-e', just as you would in `*scratch*'; but they are
  641. evaluated in the context outside of Edebug.
  642.  
  643.    The expressions you enter interactively (and their results) are lost
  644. when you continue execution unless you add them to the evaluation list
  645. with `C-c C-u'.  This command builds a new list from the first
  646. expression of each "evaluation list group".  Groups are separated by
  647. comment lines.  Be careful not to add expressions that execute
  648. instrumented code otherwise an infinite loop will result.
  649.  
  650.    When the evaluation list is redisplayed, each expression is displayed
  651. followed by the result of evaluating it, and a comment line.  If an
  652. error occurs during an evaluation, the error message is displayed in a
  653. string as if it were the result.  Therefore expressions that, for
  654. example, use variables not currently valid do not interrupt your
  655. debugging.
  656.  
  657.    Here is an example of what the evaluation list window looks like
  658. after several expressions have been added to it:
  659.  
  660.      (current-buffer)
  661.      #<buffer *scratch*>
  662.      ;---------------------------------------------------------------
  663.      (selected-window)
  664.      #<window 16 on *scratch*>
  665.      ;---------------------------------------------------------------
  666.      (point)
  667.      196
  668.      ;---------------------------------------------------------------
  669.      bad-var
  670.      "Symbol's value as variable is void: bad-var"
  671.      ;---------------------------------------------------------------
  672.      (recursion-depth)
  673.      0
  674.      ;---------------------------------------------------------------
  675.      this-command
  676.      eval-last-sexp
  677.      ;---------------------------------------------------------------
  678.  
  679.    To delete a group, move point into it and type `C-c C-d', or simply
  680. delete the text for the group and update the evaluation list with `C-c
  681. C-u'.  When you add a new group, be sure it is separated from its
  682. neighbors by a comment line.
  683.  
  684.    After selecting `*edebug*', you can return to the source code buffer
  685. with `C-c C-w'.  The `*edebug*' buffer is killed when you continue
  686. execution, and recreated next time it is needed.
  687.  
  688. 
  689. File: lispref.info,  Node: Reading in Edebug,  Next: Printing in Edebug,  Prev: Eval List,  Up: Edebug
  690.  
  691. Reading in Edebug
  692. -----------------
  693.  
  694.    To instrument a form, Edebug first reads the whole form.  Edebug
  695. replaces the standard Lisp Reader with its own reader that remembers the
  696. positions of expressions.  This reader is used by the Edebug
  697. replacements for `eval-region', `eval-defun', `eval-buffer', and
  698. `eval-current-buffer'.
  699.  
  700.    Another package, `cl-read.el', replaces the standard reader with one
  701. that understands Common Lisp reader macros.  If you use that package,
  702. Edebug will automatically load `edebug-cl-read.el' to provide
  703. corresponding reader macros that remember positions of expressions.  If
  704. you define new reader macros, you will have to define similar reader
  705. macros for Edebug.
  706.  
  707. 
  708. File: lispref.info,  Node: Printing in Edebug,  Next: Tracing,  Prev: Reading in Edebug,  Up: Edebug
  709.  
  710. Printing in Edebug
  711. ------------------
  712.  
  713.    If the result of an expression in your program contains a circular
  714. reference, you may get an error when Edebug attempts to print it.  You
  715. can set `print-length' to a non-zero value to limit the print length of
  716. lists (the number of cdrs), and in Emacs 19, set `print-level' to a
  717. non-zero value to limit the print depth of lists.  But you can print
  718. such circular structures and structures that share elements more
  719. informatively by using the `cust-print' package.
  720.  
  721.    To load `cust-print' and activate custom printing only for Edebug,
  722. simply use the command `M-x edebug-install-custom-print'.  To restore
  723. the standard print functions, use `M-x edebug-uninstall-custom-print'.
  724. You can also activate custom printing for printing in any Lisp code;
  725. see the package for details.
  726.  
  727.    Here is an example of code that creates a circular structure:
  728.  
  729.      (progn
  730.        (edebug-install-custom-print)
  731.        (setq a '(x y))
  732.        (setcar a a))
  733.  
  734.    Edebug will print the result of the `setcar' as `Result: #1=(#1#
  735. y)'.  The `#1=' notation names the structure that follows it, and the
  736. `#1#' notation references the previously named structure.  This
  737. notation is used for any shared elements of lists or vectors.
  738.  
  739.    Independent of whether `cust-print' is active, while printing
  740. results Edebug binds `print-length', `print-level', and `print-circle'
  741. to `edebug-print-length' (`50'), `edebug-print-level' (`50'), and
  742. `edebug-print-circle' (`t') respectively, if these values are
  743. non-`nil'.  Also, `print-readably' is bound to `nil' since some objects
  744. simply cannot be printed readably.
  745.  
  746. 
  747. File: lispref.info,  Node: Tracing,  Next: Coverage Testing,  Prev: Printing in Edebug,  Up: Edebug
  748.  
  749. Tracing
  750. -------
  751.  
  752.    In addition to automatic stepping through source code, which is also
  753. called *tracing* (see *Note Edebug Execution Modes::), Edebug can
  754. produce a traditional trace listing of execution in a separate buffer,
  755. `*edebug-trace*'.
  756.  
  757.    If the variable `edebug-trace' is non-nil, each function entry and
  758. exit adds lines to the trace buffer.  On function entry, Edebug prints
  759. `::::{' followed by the function name and argument values.  On function
  760. exit, Edebug prints `::::}' followed by the function name and result of
  761. the function.  The number of `:'s is computed from the recursion depth.
  762. The balanced braces in the trace buffer can be used to find the
  763. matching beginning or end of function calls. These displays may be
  764. customized by replacing the functions `edebug-print-trace-before' and
  765. `edebug-print-trace-after', which take an arbitrary message string to
  766. print.
  767.  
  768.    The macro `edebug-tracing' provides tracing similar to function
  769. enter and exit tracing, but for arbitrary expressions.  This macro
  770. should be explicitly inserted by you around expressions you wish to
  771. trace the execution of.  The first argument is a message string
  772. (evaluated), and the rest are expressions to evaluate.  The result of
  773. the last expression is returned.
  774.  
  775.    Finally, you can insert arbitrary strings into the trace buffer with
  776. explicit calls to `edebug-trace'.  The arguments of this function are
  777. the same as for `message', but a newline is always inserted after each
  778. string printed in this way.
  779.  
  780.    `edebug-tracing' and `edebug-trace' insert lines in the trace buffer
  781. even if Edebug is not active.  Every time the trace buffer is added to,
  782. the window is scrolled to show the last lines inserted.  (There may be
  783. some display problems if you use tracing along with the evaluation
  784. list.)
  785.  
  786. 
  787. File: lispref.info,  Node: Coverage Testing,  Next: The Outside Context,  Prev: Tracing,  Up: Edebug
  788.  
  789. Coverage Testing
  790. ----------------
  791.  
  792.    Edebug provides a rudimentary coverage tester and display of
  793. execution frequency.  Frequency counts are always accumulated, both
  794. before and after evaluation of each instrumented expression, even if
  795. the execution mode is `Go-nonstop'.  Coverage testing is only done if
  796. the option `edebug-test-coverage' is non-`nil' because this is
  797. relatively expensive.  Both data sets are displayed by `M-x
  798. edebug-display-freq-count'.
  799.  
  800.  - Command: edebug-display-freq-count
  801.      Display the frequency count data for each line of the current
  802.      definition.  The frequency counts are inserted as comment lines
  803.      after each line, and you can undo all insertions with one `undo'
  804.      command.  The counts are inserted starting under the `(' before an
  805.      expression or the `)' after an expression, or on the last char of
  806.      a symbol.  The counts are only displayed when they differ from
  807.      previous counts on the same line.
  808.  
  809.      If coverage is being tested, whenever all known results of an
  810.      expression are `eq', the char `=' will be appended after the count
  811.      for that expression.  Note that this is always the case for an
  812.      expression only evaluated once.
  813.  
  814.      To clear the frequency count and coverage data for a definition,
  815.      reinstrument it.
  816.  
  817.  
  818.    For example, after evaluating `(fac 5)' with an embedded breakpoint,
  819. and setting `edebug-test-coverage' to `t', when the breakpoint is
  820. reached, the frequency data is looks like this:
  821.  
  822.      (defun fac (n)
  823.        (if (= n 0) (edebug))
  824.      ;#6           1      0 =5
  825.        (if (< 0 n)
  826.      ;#5         =
  827.            (* n (fac (1- n)))
  828.      ;#    5               0
  829.          1))
  830.      ;#   0
  831.  
  832.    The comment lines show that `fac' has been called 6 times.  The
  833. first `if' statement has returned 5 times with the same result each
  834. time, and the same is true for the condition on the second `if'.  The
  835. recursive call of `fac' has not returned at all.
  836.  
  837. 
  838. File: lispref.info,  Node: The Outside Context,  Next: Instrumenting Macro Calls,  Prev: Coverage Testing,  Up: Edebug
  839.  
  840. The Outside Context
  841. -------------------
  842.  
  843.    Edebug tries to be transparent to the program you are debugging.  In
  844. addition, most evaluations you do within Edebug (see *Note Edebug
  845. Eval::) occur in the same outside context which is temporarily restored
  846. for the evaluation.  But Edebug is not completely successful and this
  847. section explains precisely how it fails.  Edebug operation unavoidably
  848. alters some data in XEmacs, and this can interfere with debugging
  849. certain programs.  Also notice that Edebug's protection against change
  850. of outside data means that any side effects *intended* by the user in
  851. the course of debugging will be defeated.
  852.  
  853. * Menu:
  854.  
  855. * Checking Whether to Stop::    When Edebug decides what to do.
  856. * Edebug Display Update::    When Edebug updates the display.
  857. * Edebug Recursive Edit::    When Edebug stops execution.
  858.  
  859. 
  860. File: lispref.info,  Node: Checking Whether to Stop,  Next: Edebug Display Update,  Up: The Outside Context
  861.  
  862. Checking Whether to Stop
  863. ........................
  864.  
  865.    Whenever Edebug is entered just to think about whether to take some
  866. action, it needs to save and restore certain data.
  867.  
  868.    * `max-lisp-eval-depth' and `max-specpdl-size' are both incremented
  869.      one time to reduce Edebug's impact on the stack.  You could,
  870.      however, still run out of stack space when using Edebug.
  871.  
  872.    * The state of keyboard macro execution is saved and restored.  While
  873.      Edebug is active, `executing-macro' is bound to
  874.      `edebug-continue-kbd-macro'.
  875.  
  876. 
  877. File: lispref.info,  Node: Edebug Display Update,  Next: Edebug Recursive Edit,  Prev: Checking Whether to Stop,  Up: The Outside Context
  878.  
  879. Edebug Display Update
  880. .....................
  881.  
  882.    When Edebug needs to display something (e.g., in trace mode), it
  883. saves the current window configuration from "outside" Edebug.  When you
  884. exit Edebug (by continuing the program), it restores the previous window
  885. configuration.
  886.  
  887.    XEmacs redisplays only when it pauses.  Usually, when you continue
  888. execution, the program comes back into Edebug at a breakpoint or after
  889. stepping without pausing or reading input in between.  In such cases,
  890. XEmacs never gets a chance to redisplay the "outside" configuration.
  891. What you see is the same window configuration as the last time Edebug
  892. was active, with no interruption.
  893.  
  894.    Entry to Edebug for displaying something also saves and restores the
  895. following data, but some of these are deliberately not restored if an
  896. error or quit signal occurs.
  897.  
  898.    * Which buffer is current, and where point and mark are in the
  899.      current buffer are saved and restored.
  900.  
  901.    * The Edebug Display Update, is saved and restored if
  902.      `edebug-save-windows' is non-`nil'.  It is not restored on error
  903.      or quit, but the outside selected window *is* reselected even on
  904.      error or quit in case a `save-excursion' is active.  If the value
  905.      of `edebug-save-windows' is a list, only the listed windows are
  906.      saved and restored.
  907.  
  908.      The window start and horizontal scrolling of the source code
  909.      buffer are not restored, however, so that the display remains
  910.      coherent.
  911.  
  912.    * The value of point in each displayed buffer is saved and restored
  913.      if `edebug-save-displayed-buffer-points' is non-`nil'.
  914.  
  915.    * The variables `overlay-arrow-position' and `overlay-arrow-string'
  916.      are saved and restored.  So you can safely invoke Edebug from the
  917.      recursive edit elsewhere in the same buffer.
  918.  
  919.    * `cursor-in-echo-area' is locally bound to `nil' so that the cursor
  920.      shows up in the window.
  921.  
  922. 
  923. File: lispref.info,  Node: Edebug Recursive Edit,  Prev: Edebug Display Update,  Up: The Outside Context
  924.  
  925. Edebug Recursive Edit
  926. .....................
  927.  
  928.    When Edebug is entered and actually reads commands from the user, it
  929. saves (and later restores) these additional data:
  930.  
  931.    * The current match data, for whichever buffer was current.
  932.  
  933.    * `last-command', `this-command', `last-command-char',
  934.      `last-input-char', `last-input-event', `last-command-event',
  935.      `last-event-frame', `last-nonmenu-event', and `track-mouse' .
  936.      Commands used within Edebug do not affect these variables outside
  937.      of Edebug.
  938.  
  939.      The key sequence returned by `this-command-keys' is changed by
  940.      executing commands within Edebug and there is no way to reset the
  941.      key sequence from Lisp.
  942.  
  943.      For Emacs 18, Edebug cannot save and restore the value of
  944.      `unread-command-char'.  Entering Edebug while this variable has a
  945.      nontrivial value can interfere with execution of the program you
  946.      are debugging.
  947.  
  948.    * Complex commands executed while in Edebug are added to the variable
  949.      `command-history'.  In rare cases this can alter execution.
  950.  
  951.    * Within Edebug, the recursion depth appears one deeper than the
  952.      recursion depth outside Edebug.  This is not true of the
  953.      automatically updated evaluation list window.
  954.  
  955.    * `standard-output' and `standard-input' are bound to `nil' by the
  956.      `recursive-edit', but Edebug temporarily restores them during
  957.      evaluations.
  958.  
  959.    * The state of keyboard macro definition is saved and restored.
  960.      While Edebug is active, `defining-kbd-macro' is bound to
  961.      `edebug-continue-kbd-macro'.
  962.  
  963. 
  964. File: lispref.info,  Node: Instrumenting Macro Calls,  Next: Edebug Options,  Prev: The Outside Context,  Up: Edebug
  965.  
  966. Instrumenting Macro Calls
  967. -------------------------
  968.  
  969.    When Edebug instruments an expression that calls a Lisp macro, it
  970. needs additional advice to do the job properly.  This is because there
  971. is no way to tell which subexpressions of the macro call may be
  972. evaluated.  (Evaluation may occur explicitly in the macro body, or when
  973. the resulting expansion is evaluated, or any time later.)  You must
  974. explain the format of macro call arguments by using `def-edebug-spec' to
  975. define an "Edebug specification" for each macro.
  976.  
  977.  - Macro: def-edebug-spec MACRO SPECIFICATION
  978.      Specify which expressions of a call to macro MACRO are forms to be
  979.      evaluated.  For simple macros, the SPECIFICATION often looks very
  980.      similar to the formal argument list of the macro definition, but
  981.      specifications are much more general than macro arguments.
  982.  
  983.      The MACRO argument may actually be any symbol, not just a macro
  984.      name.
  985.  
  986.      Unless you are using Emacs 19 or XEmacs, this macro is only defined
  987.      in Edebug, so you may want to use the following which is
  988.      equivalent: `(put 'MACRO 'edebug-form-spec 'SPECIFICATION)'
  989.  
  990.    Here is a simple example that defines the specification for the
  991. `for' macro described in the XEmacs Lisp Reference Manual, followed by
  992. an alternative, equivalent specification.
  993.  
  994.      (def-edebug-spec for
  995.        (symbolp "from" form "to" form "do" &rest form))
  996.      
  997.      (def-edebug-spec for
  998.        (symbolp ['from form] ['to form] ['do body]))
  999.  
  1000.    Here is a table of the possibilities for SPECIFICATION and how each
  1001. directs processing of arguments.
  1002.  
  1003. *`t'
  1004.      All arguments are instrumented for evaluation.
  1005.  
  1006. *`0'
  1007.      None of the arguments is instrumented.
  1008.  
  1009. *a symbol
  1010.      The symbol must have an Edebug specification which is used instead.
  1011.      This indirection is repeated until another kind of specification is
  1012.      found.  This allows you to inherit the specification for another
  1013.      macro.
  1014.  
  1015. *a list
  1016.      The elements of the list describe the types of the arguments of a
  1017.      calling form.  The possible elements of a specification list are
  1018.      described in the following sections.
  1019.  
  1020. * Menu:
  1021.  
  1022. * Specification List::        How to specify complex patterns of evaluation.
  1023. * Backtracking::        What Edebug does when matching fails.
  1024. * Debugging Backquote::    Debugging Backquote
  1025. * Specification Examples::    To help understand specifications.
  1026.  
  1027. 
  1028. File: lispref.info,  Node: Specification List,  Next: Backtracking,  Up: Instrumenting Macro Calls
  1029.  
  1030. Specification List
  1031. ..................
  1032.  
  1033.    A "specification list" is required for an Edebug specification if
  1034. some arguments of a macro call are evaluated while others are not.  Some
  1035. elements in a specification list match one or more arguments, but others
  1036. modify the processing of all following elements.  The latter, called
  1037. "keyword specifications", are symbols beginning with ``&'' (e.g.
  1038. `&optional').
  1039.  
  1040.    A specification list may contain sublists which match arguments that
  1041. are themselves lists, or it may contain vectors used for grouping.
  1042. Sublists and groups thus subdivide the specification list into a
  1043. hierarchy of levels.  Keyword specifications only apply to the
  1044. remainder of the sublist or group they are contained in and there is an
  1045. implicit grouping around a keyword specification and all following
  1046. elements in the sublist or group.
  1047.  
  1048.    If a specification list fails at some level, then backtracking may
  1049. be invoked to find some alternative at a higher level, or if no
  1050. alternatives remain, an error will be signaled.  See *Note
  1051. Backtracking:: for more details.
  1052.  
  1053.    Edebug specifications provide at least the power of regular
  1054. expression matching.  Some context-free constructs are also supported:
  1055. the matching of sublists with balanced parentheses, recursive
  1056. processing of forms, and recursion via indirect specifications.
  1057.  
  1058.    Each element of a specification list may be one of the following,
  1059. with the corresponding type of argument:
  1060.  
  1061. `sexp'
  1062.      A single unevaluated expression.
  1063.  
  1064. `form'
  1065.      A single evaluated expression, which is instrumented.
  1066.  
  1067. `place'
  1068.      A place as in the Common Lisp `setf' place argument.  It will be
  1069.      instrumented just like a form, but the macro is expected to strip
  1070.      the instrumentation.  Two functions, `edebug-unwrap' and
  1071.      `edebug-unwrap*', are provided to strip the instrumentation one
  1072.      level or recursively at all levels.
  1073.  
  1074. `body'
  1075.      Short for `&rest form'.  See `&rest' below.
  1076.  
  1077. `function-form'
  1078.      A function form: either a quoted function symbol, a quoted lambda
  1079.      expression, or a form (that should evaluate to a function symbol
  1080.      or lambda expression).  This is useful when function arguments
  1081.      might be quoted with `quote' rather than `function' since the body
  1082.      of a lambda expression will be instrumented either way.
  1083.  
  1084. `lambda-expr'
  1085.      An unquoted anonymous lambda expression.
  1086.  
  1087. `&optional'
  1088.      All following elements in the specification list are optional; as
  1089.      soon as one does not match, Edebug stops matching at this level.
  1090.  
  1091.      To make just a few elements optional followed by non-optional
  1092.      elements, use `[&optional SPECS...]'.  To specify that several
  1093.      elements should all succeed together, use `&optional [SPECS...]'.
  1094.      See the `defun' example below.
  1095.  
  1096. `&rest'
  1097.      All following elements in the specification list are repeated zero
  1098.      or more times.  All the elements need not match in the last
  1099.      repetition, however.
  1100.  
  1101.      To repeat only a few elements, use `[&rest SPECS...]'.  To specify
  1102.      all elements must match on every repetition, use `&rest
  1103.      [SPECS...]'.
  1104.  
  1105. `&or'
  1106.      Each of the following elements in the specification list is an
  1107.      alternative, processed left to right until one matches.  One of the
  1108.      alternatives must match otherwise the `&or' specification fails.
  1109.  
  1110.      Each list element following `&or' is a single alternative even if
  1111.      it is a keyword specification. (This breaks the implicit grouping
  1112.      rule.)  To group two or more list elements as a single
  1113.      alternative, enclose them in `[...]'.
  1114.  
  1115. `¬'
  1116.      Each of the following elements is matched as alternatives as if by
  1117.      using `&or', but if any of them match, the specification fails.
  1118.      If none of them match, nothing is matched, but the `¬'
  1119.      specification succeeds.
  1120.  
  1121. `&define'
  1122.      Indicates that the specification is for a defining form.  The
  1123.      defining form itself is not instrumented (i.e. Edebug does not
  1124.      stop before and after the defining form), but forms inside it
  1125.      typically will be instrumented.  The `&define' keyword should be
  1126.      the first element in a list specification.
  1127.  
  1128.      Additional specifications that may only appear after `&define' are
  1129.      described here.  See the `defun' example below.
  1130.  
  1131.     `name'
  1132.           The argument, a symbol, is the name of the defining form.
  1133.           But a defining form need not be named at all, in which case a
  1134.           unique name will be created for it.
  1135.  
  1136.           The `name' specification may be used more than once in the
  1137.           specification and each subsequent use will append the
  1138.           corresponding symbol argument to the previous name with ``@''
  1139.           between them.  This is useful for generating unique but
  1140.           meaningful names for definitions such as `defadvice' and
  1141.           `defmethod'.
  1142.  
  1143.     `:name'
  1144.           The element following `:name' should be a symbol; it is used
  1145.           as an additional name component for the definition.  This is
  1146.           useful to add a unique, static component to the name of the
  1147.           definition.  It may be used more than once.  No argument is
  1148.           matched.
  1149.  
  1150.     `arg'
  1151.           The argument, a symbol, is the name of an argument of the
  1152.           defining form.  However, lambda list keywords (symbols
  1153.           starting with ``&'') are not allowed.  See `lambda-list' and
  1154.           the example below.
  1155.  
  1156.     `lambda-list'
  1157.           This matches the whole argument list of an XEmacs Lisp lambda
  1158.           expression, which is a list of symbols and the keywords
  1159.           `&optional' and `&rest'
  1160.  
  1161.     `def-body'
  1162.           The argument is the body of code in a definition.  This is
  1163.           like `body', described above, but a definition body must be
  1164.           instrumented with a different Edebug call that looks up
  1165.           information associated with the definition.  Use `def-body'
  1166.           for the highest level list of forms within the definition.
  1167.  
  1168.     `def-form'
  1169.           The argument is a single, highest-level form in a definition.
  1170.           This is like `def-body', except use this to match a single
  1171.           form rather than a list of forms.  As a special case,
  1172.           `def-form' also means that tracing information is not output
  1173.           when the form is executed.  See the `interactive' example
  1174.           below.
  1175.  
  1176. `nil'
  1177.      This is successful when there are no more arguments to match at the
  1178.      current argument list level; otherwise it fails.  See sublist
  1179.      specifications and the backquote example below.
  1180.  
  1181. `gate'
  1182.      No argument is matched but backtracking through the gate is
  1183.      disabled while matching the remainder of the specifications at
  1184.      this level.  This is primarily used to generate more specific
  1185.      syntax error messages.  See *Note Backtracking:: for more details.
  1186.      Also see the `let' example below.
  1187.  
  1188. `OTHER-SYMBOL'
  1189.      Any other symbol in a specification list may be a predicate or an
  1190.      indirect specification.
  1191.  
  1192.      If the symbol has an Edebug specification, this "indirect
  1193.      specification" should be either a list specification that is used
  1194.      in place of the symbol, or a function that is called to process the
  1195.      arguments.  The specification may be defined with `def-edebug-spec'
  1196.      just as for macros. See the `defun' example below.
  1197.  
  1198.      Otherwise, the symbol should be a predicate.  The predicate is
  1199.      called with the argument and the specification fails if the
  1200.      predicate fails.  The argument is not instrumented.
  1201.  
  1202.      Predicates that may be used include: `symbolp', `integerp',
  1203.      `stringp', `vectorp', `atom' (which matches a number, string,
  1204.      symbol, or vector), `keywordp', and `lambda-list-keywordp'.  The
  1205.      last two, defined in `edebug.el', test whether the argument is a
  1206.      symbol starting with ``:'' and ``&'' respectively.
  1207.  
  1208. `[ELEMENTS...]'
  1209.      Rather than matching a vector argument, a vector treats the
  1210.      ELEMENTS as a single "group specification".
  1211.  
  1212. `"STRING"'
  1213.      The argument should be a symbol named STRING.  This specification
  1214.      is equivalent to the quoted symbol, `'SYMBOL', where the name of
  1215.      SYMBOL is the STRING, but the string form is preferred.
  1216.  
  1217. `'SYMBOL or (quote SYMBOL)'
  1218.      The argument should be the symbol SYMBOL.  But use a string
  1219.      specification instead.
  1220.  
  1221. `(vector ELEMENTS...)'
  1222.      The argument should be a vector whose elements must match the
  1223.      ELEMENTS in the specification.  See the backquote example below.
  1224.  
  1225. `(ELEMENTS...)'
  1226.      Any other list is a "sublist specification" and the argument must
  1227.      be a list whose elements match the specification ELEMENTS.
  1228.  
  1229.      A sublist specification may be a dotted list and the corresponding
  1230.      list argument may then be a dotted list.  Alternatively, the last
  1231.      cdr of a dotted list specification may be another sublist
  1232.      specification (via a grouping or an indirect specification, e.g.
  1233.      `(spec .  [(more specs...)])') whose elements match the non-dotted
  1234.      list arguments.  This is useful in recursive specifications such
  1235.      as in the backquote example below.  Also see the description of a
  1236.      `nil' specification above for terminating such recursion.
  1237.  
  1238.      Note that a sublist specification of the form `(specs .  nil)'
  1239.      means the same as `(specs)', and `(specs .
  1240.      (sublist-elements...))' means the same as `(specs
  1241.      sublist-elements...)'.
  1242.  
  1243.